﻿namespace WMS6.Web.CrossDock
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class FlowThruAllocationQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlAllowOverShipment;
        protected DropDownList ddlCustomerID;
        protected DropDownList ddlMaximumPerOver;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSeqNo;
        protected HtmlForm F79620;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblAllowOverShipment;
        protected Label lblArea;
        protected Label lblCustomerID;
        protected Label lblMaximumPerOver;
        protected Label lblOwnerID;
        protected Label lblSeqNo;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtAllowOverShipment;
        protected TextBox txtCustomerID;
        protected TextBox txtMaximumPerOver;
        protected TextBox txtOwnerID;
        protected TextBox txtSeqNo;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("FlowThruApportionmentRuleList.aspx?action={0}&from=list", this.hdnActionID.Value.Trim()), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("FlowThruApportionmentRuleList.aspx?action={0}", this.hdnActionID.Value.Trim()), false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlCustomerID, 0);
            base.InitQueryDDL(this.ddlSeqNo, 0);
            base.InitQueryDDL(this.ddlMaximumPerOver, 0);
            base.InitQueryDDL(this.ddlAllowOverShipment, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnNew.Visible = false;
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string AllowOverShipment
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAllowOverShipment.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAllowOverShipment.Text.Trim(), this.ddlAllowOverShipment.SelectedValue);
                }
                return "";
            }
        }

        public string CustomerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCustomerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCustomerID.Text.Trim(), this.ddlCustomerID.SelectedValue);
                }
                return "";
            }
        }

        public string MaximumPerOver
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtMaximumPerOver.Text.Trim()))
                {
                    return base.GetParamsString(this.txtMaximumPerOver.Text.Trim(), this.ddlMaximumPerOver.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string SeqNo
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSeqNo.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSeqNo.Text.Trim(), this.ddlSeqNo.SelectedValue);
                }
                return "";
            }
        }
    }
}

